package mylibrary.activeMQ;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class TextListener implements MessageListener{

	public void onMessage(Message message) {
	
		TextMessage msg = null;
		
		try {
			if (message instanceof TextMessage) {
				msg = (TextMessage) message;
				System.out.println("Reading message: " + msg.getText());
			} else {
				System.out.println("Message of wrong type: " + message.getClass().getName());
			}
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}
}
